Material Templates - Wildcard Asterisks with more control

Hello,

I am attempting to determine if there is a way to use asterisks as wildcards in Material Templates with more specificity, especially with Part-based templates. Based on all available documentation that I can find, and my own experimentation, Wildcards can only change the function of a template in one way - to alter the template rule source parameters from a specific search to a broader one, based on the given text. However, I am finding this broad parameter to be too wide in certain circumstances, and need to find a way to refine the parameter’s pattern.

I am working in a gigantic database, where the categorization system for different CAD parts is based on a 10-digit code, with the first 3 digits describe color, material, and finish properties for the object. It therefore makes sense to build Parts Material Templates that reads the first 3 digits of every part in a CAD assembly in Keyshot, and assign designated materials to those parts. In this example, let’s say I am working with a CAD object with a name beginning in the code 795 that would be a basic Aluminum; in the Parts Material Template, I would therefore create a rule where the source of 795* would convert to Aluminum, using an asterisk wildcard.

In such a large database, there is eventually a CAD object with a code including the numbers 795 elsewhere in it’s name, and it disrupts the understood rules of the Parts Material Template. In this example, let’s say an assembly also includes a part named 1000000795, and these first 3 digits were not included as a rule. The Parts Material Template would see that the name of the CAD object included a recognized source, 795, and automatically convert it to Aluminum. This would happen despite the fact that the CAD object in question was not intended to be Aluminum based on the categorization system of this database, and despite the fact that those digits appeared at the end of the CAD object’s name, not the beginning.

Based on previous experience with the wildcard asterisk concept in other programs, I usually see it function like this:

  • A single asterisk AFTER a name will create parameters to identify ONLY items that START with the given name (795* = 7950000000)
  • A single asterisk BEFORE a name will create parameters to identify ONLY items that END with the given name (*795 = 1000000795)
  • A pair of asterisks both before AND after a name will create parameters to identify ANY items that INCLUDE the given name as any portion of its total name (* 795 * = 1007950000)
  • NO asterisks in a name will create parameters to identify ONLY items with that SPECIFIC name, and no others. (795 = 795)

Below is a rough example of the type of Parts Material Template I am trying to make. Bear in mind it is only an example, but suffice to say that I have attempted more complex templates with far more rules that are not doing the job.

image

Are there any solutions to my problem? Am i using the system correctly? Does anyone else have any other solutions or workaround for this type of work? Is there a more in-depth functionality to wildcards and material templates that i am missing from the forums, manuals, and tutorials? Any help would be appreciated. I am using Keyshot 11.3.3 Pro, I can provide any other details as necessary.

One alternative solution is scripting. Then you can include mapping tables (e.g. CSV, XLS, …) to your process.
Maybe Luxion can implement RegEx (Regular Expressions). Ths would allow more specific control.

1 Like

I’m rubbish with RegEx but maybe it also helps if they would add the ‘?’ as a location specific wildcard as it’s used in oldskool DOS I believe?

1 Like

ChatGPT is good at RegEx.

1 Like

I had claude.ai help with some code for another project, and it almost worked, I was just playing around to see how viable it is to use, and I think with some more education on my part it would be totally valid thing! There are other LLM’s that are specifically tasked to code generation for various languages and dang it would be a huge thing if one of them got good enough to shoot out properly working code from a set of promtps from an uneducated code butcher like myself. There are many things I would love to script with KS, I just dont’ have the time and frankly the guts to dive into it.

I never think of using ChatGPT for such things, I should.